<?php

class userGalleryComponents extends myComponents {

  public function executeRender() {
	$this->node = $this->getRoute()->getObject();
	$this->pager = $this->getUserGalleryPictures();
  }
  
  protected function getUserGalleryPictures() {
	$bg = Doctrine::getTable('BannerGroup')->findOneByType('frontend_gallery');
	$pager = new sfDoctrinePager('Banner',12);
	$pager->getQuery()->from('Banner b')->where('b.is_active = ?', 1)->andWhere('b.banner_group_id = ?', $bg->getId());
	$pager->setPage($this->getRequestParameter('page',1));
	$pager->init();
	return $pager;
  }
}